﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SMS.Helper
{
    public static class DateTimeHelper
    {
        public static DateTime FirstDateOfTheMonth(int Month, int year)
        {
            return new DateTime(year, Month, 1);
        }

        public static DateTime LastDateOfTheMonth(int Month, int year)
        {
            return new DateTime(year, Month, 1).AddMonths(1).AddDays(-1);
        }

        public static DateTime FirstDateOfTheWeek(int WeekNo, int year)
        {
            return new DateTime(year, 1, 1).AddDays((WeekNo) * 7 - 7);
        }

        public static DateTime LastDateOfTheWeek(int WeekNo, int year)
        {
            return new DateTime(year, 1, 1).AddDays(WeekNo * 7 - 1);
        }

        public static DateTime FirstDateOfQuarter(int QuarterNo, int year)
        {
            return new DateTime(year, (QuarterNo - 1) * 3 + 1, 1);
        }

        public static DateTime LastDateOfQarter(int QuarterNo, int year)
        {
            return new DateTime(year, (QuarterNo) * 3, 1).AddMonths(1).AddDays(-1);
        }

        public static DateTime FirstDateOfHalfYear(int HalfYearNo, int year)
        {
            return new DateTime(year, (HalfYearNo - 1) * 6 + 1, 1);
        }

        public static DateTime LastDateOfHalfYear(int HalfYearNo, int year)
        {
            return new DateTime(year, HalfYearNo * 6, 1).AddMonths(1).AddDays(-1);
        }

        public static DateTime FirstDateOfYear(int year)
        {
            return new DateTime(year, 1, 1);
        }

        public static DateTime LastDateOfYear(int year)
        {
            return new DateTime(year, 1, 1).AddYears(1).AddDays(-1);
        }

        public static DateTime LastDateOfQarter(int year)
        {
            return new DateTime(year + 1, 1, 1).AddDays(-1);
        }

    }
}
